<?php

	class Comment_model extends CI_Model {

		protected $__tbname = 'comment';
		protected $__dbconf = 'default';

		var $id;	//int(11) unsigned	Primary Key	Auto Increment	NOT NULL
		var $id_video = 0;	//int(11) unsigned			NULL
		var $author = 0;	//int(11) unsigned			NULL
		var $title;	//varchar(100)			NOT NULL
		var $content;	//text			NULL
		var $published_date;	//datetime			NULL
		var $created_date = CURRENT_TIMESTAMP;	//timestamp			NOT NULL
		var $modified_date;	//datetime			NULL
		var $id_comment;	//varchar(255)			NOT NULL

		protected $__validation_rule = array(
			'id' => array('key' => 'PRI', 'type' => 'int', 'null' => FALSE, 'auto_increment' => TRUE),
			'id_video' => array('type' => 'int', 'null' => TRUE),
			'author' => array('type' => 'int', 'null' => TRUE),
			'title' => array('type' => 'varchar', 'size' => 100, 'null' => FALSE),
			'content' => array('type' => 'text', 'null' => TRUE),
			'published_date' => array('type' => 'datetime', 'null' => TRUE),
			'created_date' => array('type' => 'timestamp', 'null' => FALSE),
			'modified_date' => array('type' => 'datetime', 'null' => TRUE),
			'id_comment' => array('type' => 'varchar', 'size' => 255, 'null' => FALSE)
		);

		protected $__relation = array(
			array('table' => 'video', 'foreign_key' => 'id_video'),
			array('table' => 'comment', 'foreign_key' => 'id_comment')
		);
	}
